<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>后台管理员登录界面</title>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery1.9.0.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/xcConfirm.css"/>
<script src="${pageContext.request.contextPath }/js/xcConfirm.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    $(document).ready(function(){
    	/*表单鼠标经过移出事件*/
    	$("#at").mouseover(function(){
    		$("#at").css("border-color","#33FFFF");
    	});
    	$("#at").mouseout(function(){
    		$("#at").css("border-color","#BBFFEE");
    	});
    	
    	$("#pd").mouseover(function(){
    		$("#pd").css("border-color","#33FFFF");
    	});
    	$("#pd").mouseout(function(){
    		$("#pd").css("border-color","#BBFFEE");
    	});
    	
    	login();
	});
    
    function login(){
    	$("#btn").bind("click",function(){
    		if($("#at").val()==''){
    			$("#userWarn").show();
        	}else{
        		$("#userWarn").hide();
        	}
    		if($("#pd").val() ==''){
        		$("#pdWarn").show();
        	}else{
        		$("#pdWarn").hide();
        	}
        	if($("#at").val()!='' && $("#pd").val()!=''){
        		$.ajax({
        			url:'loginAction.action',//请求的远程url
        			data:$("#actionForm").serialize(),//发送到服务器的数据
        			type:"POST",//默认值: "GET")。请求方式 ("POST" 或 "GET")
        			dataType:"json",//服务器返回的数据类型，有几种返回类型：xml,html,script,json,text(默认)
        			success:function(data){//请求成功后的回调函数
        				 var map = eval('('+data+')');
        			     if(map.empInfo != null){
        			    	 if(map.empInfo.empstatus == '1'){
        	    			    	window.location.href="index.jsp";
        	    			    }else if(map.empInfo.empstatus == '0'){
        	    			    	var txt = "你的账号已被禁用，请联系管理员！";
        	    					window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.warning);
        	    			        
        	    			    }
        			    	 
        			     }else{
        			    	var txt = "您输入的账号/密码错误，请重新输入！";
        			    		window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
        			     }
        			}
        		});
        	}
    	});
	}
</script>
<style type="text/css">
	body{ background:url(${pageContext.request.contextPath }/img/login_bg.jpg);}
	.tit{ margin:auto; margin-top:170px; text-align:center; width:500px; padding-bottom:20px;}
	.login-wrap{ width:220px; padding:30px 50px 0 330px; height:220px; background:#fff url(${pageContext.request.contextPath }/img/loginbg.jpg) no-repeat 30px 40px; margin:auto; overflow: hidden;}
	.login_input{ display:block;width:210px; height: 20px;}
	.login_user{ background: url(${pageContext.request.contextPath }/img/input_icon_1.png) no-repeat 200px center;height: 30px;border: solid;border-color:#BBFFEE }
	.login_password{ background: url(${pageContext.request.contextPath }/img/input_icon_2.png) no-repeat 200px center;height: 30px;border: solid;border-color: #BBFFEE}
	.btn{display:block;text-decoration:none;height: 35px;width: 220px;text-align: center}
	.btn-login{ background:#33CCFF; box-shadow:none; text-shadow:none; color:#fff; border:none;height:35px;line-height:35px; font-size:20px; font-family:"microsoft yahei";}
	.btn-login:hover{ background:#00BBFF; color:#fff;}
	tr{display: block;margin: 20px 0;}
	.copyright{ margin:auto; margin-top:10px; text-align:center; width:370px; color:#CCC}
	@media (max-height: 700px) {.tit{ margin:auto; margin-top:100px; }}
	@media (max-height: 500px) {.tit{ margin:auto; margin-top:50px; }}
	.sgBtn{width: 135px; height: 35px; line-height: 35px; margin-left: 10px; margin-top: 10px; text-align: center; background-color: #0095D9; color: #FFFFFF; float: left; border-radius: 5px;}
</style>
</head>
<body>
	<div class="tit">
	    <span><font size="7" style="color: white">递四方物流管理系统</font></span>
	</div>
	<div class="login-wrap">
	 <form id="actionForm" method="post">
	    <table width="100%" border="0" cellspacing="0" cellpadding="0">
		    <tr>
		      <td><input id="at" type="text" class="login_input login_user" name="empInfo.empid" placeholder="请输入工号" /> </td>
		      <td><img id="userWarn" src="${pageContext.request.contextPath }/img/warning.png" style="display: none"></td>
		    </tr>
		    <tr>
		      <td><input id="pd" type="password"  class="login_input login_password" name="empInfo.emppassword" placeholder="请输入密码" /></td>
		      <td><img id="pdWarn" src="${pageContext.request.contextPath }/img/warning.png" style="display: none"></td>
		    </tr>
		    <tr>
		      <td height="35" width="220" valign="bottom"><input id="btn" type="button" class="btn btn-block btn-login" value="登录"/> </td>
		    </tr>
		  </table>
	 </form>
	</div>
	<div class="copyright">为了让你获得更好的体验，请使用谷歌浏览器</div>
</body>
</html>